package app.kotlin_1.fragment

import android.os.Bundle
import android.support.v7.widget.LinearLayoutManager
import android.view.View
import app.kotlin_1.R
import app.kotlin_1.adapter.ProductAdapter
import app.kotlin_1.base.BaseFragment
import app.kotlin_1.bean.GameBean
import  kotlinx.android.synthetic.main.title_common.view.*
import kotlinx.android.synthetic.main.fragment_product.view.*


/**
 * Created by 刘智强 on 2017/9/19.
 */
class ProductFragment : BaseFragment() {
    private var datas = mutableListOf<GameBean>()

    companion object {
        fun newInstance(args: String): ProductFragment {
            val fragment = ProductFragment()
            val bundle = Bundle()
            bundle.putString("args", args)
            fragment.arguments = bundle
            return fragment

        }
    }

    override fun getLayoutId(): Int = R.layout.fragment_product

    override fun initData() {
        rootView?.tvTitle?.text = "排行"
        datas.add(GameBean(0, 0, "总榜", "", "", ""))
        datas.add(GameBean(1, 1, "爱奇艺", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1507626370338&di=e64ef02ad0bdc138e2d4b9ad04253e41&imgtype=0&src=http%3A%2F%2Fwork.361ser.com%2FContent%2Fueditor%2Fnet%2Fupload%2Fimage%2F20160815%2F6360687078441877134177581.png", "凤凰无双全网独播", "29.77M"))
        datas.add(GameBean(1, 2, "手机淘宝", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1507626488129&di=d3dc148544e7b8267b26b8de58d6a988&imgtype=0&src=http%3A%2F%2Fimgs.soufun.com%2Fnews%2F2015_11%2F10%2Fhome%2F1447138438957_000.jpg", "随时随地，想淘就淘！", "75.44M"))
        datas.add(GameBean(1, 3, "手机百度", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1507625928409&di=5701f23b80c0197fcef0f102ee8a7d63&imgtype=0&src=http%3A%2F%2Fimg14.3lian.com%2F201607%2F29%2F42768151547d1d55176ca4ab366d42e7.jpg", "个性化新闻阅读的中文搜索应用", "49.00M"))
        datas.add(GameBean(1, 4, "UC浏览器", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1507626011969&di=00e97f43f1989023097b6b51f75404d4&imgtype=0&src=http%3A%2F%2Fupload.gezila.com%2Fessential%2F1402392493.png", "UC浏览器，最热的影视小说,最火的人气漫画...", "31.24M"))
        datas.add(GameBean(1, 5, "优酷", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1507626031276&di=081a11a76653c1f62da59436bd392e8d&imgtype=0&src=http%3A%2F%2Fimg.dyxtw.com%2Fuploadfile%2F2015%2F0403%2F20150403052321480.jpg", "蒙面唱将，反黑全网独播", "56.8MM"))
        datas.add(GameBean(0, 0, "畅销游戏", "", "", ""))
    }

    override fun initView(v: View) {
    }

    override fun initListener() {
    }

    override fun setOnClick(v: View?) {
    }

    override fun requestData() {
    }

    override fun setData() {
        rootView?.rvProduct?.layoutManager = LinearLayoutManager(context)
        rootView?.rvProduct?.adapter = ProductAdapter(context, datas)
    }
}